<?php
 header('Content-Type:text/json;charset=utf-8');
$servername = "localhost";
$username = "root";
$password = "123";
$dbname = "test";
 
// 创建连接
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
    die("连接失败: " . mysqli_connect_error());
}
 
$sql = "SELECT * FROM orders";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
    //输出数据
    $results = array();
    while($row = mysqli_fetch_assoc($result)) {
    	$results[] = $row;
    }
    $jsonencode = json_encode($results,JSON_UNESCAPED_UNICODE);
	echo urldecode($jsonencode);
} else {
    echo "0 结果";
}
 
mysqli_close($conn);

?>